import axios from '@/utils/request'

export function getRoleList(params) {
  return axios({
    url: '/sys/role',
    params
  })
}

export function addRole(data) {
  return axios({
    url: '/sys/role',
    method: 'post',
    data
  })
}

export function editRole(data) {
  return axios({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

export function delRole(id) {
  return axios({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

export function getEnableRole() {
  return axios({
    url: '/sys/role/list/enabled'
  })
}

export function getRoleDetail(id) {
  return axios({
    url: `/sys/role/${id}`
  })
}

export function getRolePermit(data) {
  return axios({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
